package service.impl;

import java.sql.SQLException;
import java.util.List;

import bean.Ajax;

import dao.impl.AuthDaoImpl;
import dao.impl.RoleDaoImpl;

import entity.Auth;
import entity.Role;

import service.RoleService;

public class RoleServiceImpl implements RoleService{
	RoleDaoImpl roleDao = new RoleDaoImpl();
	AuthDaoImpl authDao = new AuthDaoImpl();
	public Ajax<Role> getList(int offset, int limit, String condition, String order) throws SQLException {
		Ajax<Role> ajaxRole = new Ajax<Role>();
		ajaxRole.setRows(roleDao.getList(offset, limit, condition, order));
		int total = roleDao.getListCount(condition);
		ajaxRole.setTotal(total);
		return ajaxRole;
	}
	public List<Role> getRoleList() throws SQLException {
		return roleDao.getRoleList();
	}
	public List<Auth> getAuthList() throws SQLException {
		return authDao.getAuthList();
	}
	public int addRole(Role role) throws SQLException {
		return roleDao.addRole(role);
	}
	public int deleteRoleById(String id) throws SQLException {
		return roleDao.deleteRoleById(id);
	}
	public Role getRoleById(String id) throws SQLException {
		return roleDao.getRoleById(id);
	}
	public int editRole(Role role) throws SQLException {
		return roleDao.editRole(role);
	}
	public List<Auth> getRoleAuthList() throws SQLException {
		return authDao.getRoleAuthList();
	}

}
